ZZZ Projects Z.Entity Framework Extensions v3.9.40 Retail
Dramatically Improve EF Performance with Bulk SaveChanges and Bulk Operations
Improve SaveChanges Performance
Use scalable bulk operations and always get the bestperformance available for your database provider.
- SQL Server 2008+
- SQL Azure
- SQL Compact
- MySQL
- SQLite
- PostgreSQL
- Oracle (Coming soon)
Bulk SaveChanges
Improving your applications performance couldn’t have been made easier!
- Easy to use
- Easy to customize
- Easy to maintain
// Easy to use
context.BulkSaveChanges();
// Easy to customize
context.BulkSaveChanges(operation => operation.BatchSize = 1000);Bulk Operations
Use flexible features to overcome Entity Framework limitations- Choose batch size
- Choose columns
- Choose primary key
// Use all kind of bulk operations context.BulkInsert(customers); context.BulkUpdate(customers); context.BulkDelete(customers); // Customize your operation context.BulkMerge(customers, operation => { operation.BatchSize = 1000; operation.ColumnPrimaryKeyExpression = customer => customer.Code; });
Bulk from LINQ Query
Perform bulk operations from LINQ Query without loading entities in the context.
- DeleteFromQuery
- UpdateFromQuery
// DELETE all customers that are inactive for more than 2 years
context.Customers
.Where(x=>x.LastLogin<DateTime.Now.AddYears(-2))
.DeleteFromQuery(operation=>operation.BatchSize=10000);
// UPDATE all customers that are inactive for more than 2 years
context.Customers
.Where(x=>x.Actif&&x.LastLogin<DateTime.Now.AddYears(-2))
.UpdateFromQuery(x=>newCustomer{Actif=false});